package com.leoman.plz_p.adapter;

import android.content.Context;
import android.widget.TextView;

import com.leoman.plz_p.R;
import com.leoman.plz_p.module.bean.QuestionStatusBean;

import cn.com.corelib.utils.adapter.BaseAdapterHelper;
import cn.com.corelib.utils.adapter.normal.QuickAdapter;

/**
 * Created by guoh on 2018/7/7.
 */
public class ExamListAdapter extends QuickAdapter<QuestionStatusBean> {

    private int currentPosition=0;
    public void setCuttentPosition(int currentPosition){
        this.currentPosition=currentPosition;
    }

    private boolean isNotNormalExam=true;
    public void setIsNotNormalExam(boolean b){
        this.isNotNormalExam=b;
    }
    public ExamListAdapter(Context context) {
        super(context, R.layout.item_exam_list);
    }

    @Override
    protected void convert(BaseAdapterHelper helper, QuestionStatusBean item, int position) {
        TextView textView=helper.getView(R.id.tv_position);
        helper.setText(R.id.tv_position,(position+1)+"");
        if (!isNotNormalExam&&item.getRight()!=null){
            textView.setBackground(context.getResources().getDrawable(R.mipmap.icon_current_status));
        }else {
            if (item.getRight() == null) {
                textView.setBackground(context.getResources().getDrawable(R.mipmap.icon_noraml_status));
            } else if (item.getRight() == true) {
                textView.setBackground(context.getResources().getDrawable(R.mipmap.icon_right_status));
            } else if (item.getRight() == false) {
                textView.setBackground(context.getResources().getDrawable(R.mipmap.icon_error_status));
            }
        }
//        if (currentPosition==position) {
//            textView.setBackground(context.getResources().getDrawable(R.mipmap.icon_current_status));
//        }
    }
}
